package com;

import com.model.AcmeProperties5;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 软注入-构造方式的传播性
 * 如果@EnableConfigurationProperties(AcmeProperties5.class)被注释，启动报错
 */
@RestController
@EnableConfigurationProperties(AcmeProperties5.class)
public class EnabelConfigInnerSpread1Controller {

    @Configuration
    class Test {
        public Test(AcmeProperties5 acmeProperties5) {
            System.out.println(acmeProperties5); // 打印：AcmeProperties5(enabled=true, remoteAddress=/192.168.1.5)
        }
    }

    @RequestMapping("acme5")
    public String acme5(AcmeProperties5 acmeProperties5) {
        System.out.println(acmeProperties5);
        return "acme5";
    }
}
